package com.bytedance.lucky.error;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zouyaowen
 * @date 2021-02-12 21:18
 */
@Getter
@AllArgsConstructor
public enum ExceptionEnum implements CommonError {

    /**
     * 常见异常枚举
     */
    PARAM_ERROR(-1, "参数异常"),
    UN_AUTHORIZATION(403, "请求未授权"),
    NOT_FOUND(404, "请求资源不存在"),
    HTTP_METHOD_ERROR(405, "HTTP请求方法不正确"),
    INTERNAL_ERROR(500, "服务器内部错误"),
    DATA_ERROR(500001, "数据异常"),
    DATA_NOT_EXIST(404001, "数据不存在"),
    AUTHENTICATION_NOT_EXIST(40004, "用户认证信息不存在"),
    AUTHENTICATION_ERROR(40005, "用户认证信息异常"),
    AUTHENTICATION_EXPIRED(40006, "用户认证信息已过期"),
    ;

    /**
     * 状态码
     */
    private Integer status;
    /**
     * 异常信息
     */
    private String message;

    @Override
    public String getErrorMessage() {
        return this.message;
    }

    @Override
    public Integer getErrorStatus() {
        return this.status;
    }

    @Override
    public CommonError setErrorMessage(String errorMessage) {
        this.setErrorMessage(errorMessage);
        return this;
    }
}
